package com.whu.waterworks.util;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {
	
	/**
	 * 判断输入的时间是否为当天时间
	 * @param date
	 * @return
	 */
	public boolean isToday(Date date)
	{		
		Calendar now = Calendar.getInstance();
		int yearNow = now.get(Calendar.YEAR);
		int monthNow = now.get(Calendar.MONTH);
		int dateNow = now.get(Calendar.DATE);
		
		Calendar endTime = Calendar.getInstance();
		endTime.setTime(date);
		int yearEnd = endTime.get(Calendar.YEAR);
		int monthEnd = endTime.get(Calendar.MONTH);
		int dateEnd = endTime.get(Calendar.DATE);
		
		if(yearNow==yearEnd && monthEnd==monthNow && dateNow==dateEnd)
		{
			return true;
		}
		else {
			return false;
		}
		
	}

}
